package com.SuanFa.lanqiao;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class a5 {
    public static void main(String[] args) {

        int jingdu = 100;
        BigDecimal bigDecimal1=calculateGoldenRatio1(jingdu);
        System.out.println(bigDecimal1);
    }

    private static BigDecimal calculateGoldenRatio1(int jingdu) {
        BigDecimal result = BigDecimal.ONE;
        for (int i = 0; i < jingdu + 10; i++) {
            result=BigDecimal.ONE.add(BigDecimal.ONE.divide(result,jingdu, RoundingMode.HALF_UP));
        }
        BigDecimal divide = result.setScale(jingdu,RoundingMode.HALF_UP);
        return divide.subtract(BigDecimal.ONE);
    }
}
